import util from '../other/util';


var ckEditorObject = function () {
    this.id = util.Guid();
    this.html = $('<textarea id="' + this.id + '"></textarea>');
    this.Obj = null;

};
ckEditorObject.prototype.render = function () {
    if (CKEDITOR) {
        this.Obj = CKEDITOR.replace(this.html[0], { toolbar: 'Basic' });
    } else {
        console.error('Form => CKEDITOR => 请引用 CKEditer 库');
    };
};
ckEditorObject.prototype.set = function (data) {
    setTimeout(() => {
        this.Obj.setData(data);
    }, 300);
};
ckEditorObject.prototype.get = function (callBack, ignore) {
    var value = this.Obj.document.getBody().getHtml();
    callBack(false, value);
    return this;
};
ckEditorObject.prototype.clear = function () {
    this.Obj.setData('');
};
export default ckEditorObject;
